<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			//concat
			// 连接两个字符串返回一个新字符串,并且不会被修改
			
			var str1 = "abc";
			var str2 = "123";
			var str3 = str1.concat(str2);
			console.log(str1);
			console.log(str2);
			console.log(str3);
			
			var str = "I love my family!";
			console.log(str);
			
			//slice()		根据索引值和索引值截取字符串
			console.log(str.slice(2));//从索引截取到最后
			console.log(str.slice(2,5));//从索引截取包左不包右
			console.log(str.slice(-3));//后几个
			console.log(str.slice(5,2));//空字符串
			
			
			//substr();		根据索引值和长度值截取字符串
			console.log(str.substr(2));//从索引截取到最后
			console.log(str.substr(2,6));//从索引截取,长度个字符串
			console.log(str.substr(-3));//后几个
			console.log(str.substr(5,2));//从索引截取,长度个字符串
			console.log(str.substr(16,6));//只截取长度里有的
			
			//substring();		根据索引值和索引值截取字符串
			console.log(str.substring(2));
			//从索引截取到最后
			console.log(str.substring(2,5));//从索引截取包左不包右
			console.log(str.substring(-1));//全部隐藏
			console.log(str.substring(5,2));//智能调换
		</script>
		
		
	</body>
</html>
